//
//  ZRTabBarViewController.m
//  ReadKit
//
//  Created by yd on 16/3/8.
//  Copyright © 2016年 yd. All rights reserved.
//

#import "ZRTabBarViewController.h"
#import "ZR_oneViewController.h"
#import "ZR_twoViewController.h"
#import "ZR_threeViewController.h"
#import "ZR_fourViewController.h"
#import "ZRNavigationViewController.h"


@interface ZRTabBarViewController ()

@end

@implementation ZRTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    ZR_oneViewController *one = [[ZR_oneViewController alloc] init];
    [self addChildVC:one title:@"首页" image:@"阅读主页jjjj_11" selectedImage:@"阅读主页2_03"];
    ZR_twoViewController *two = [[ZR_twoViewController alloc] init];
    [self addChildVC:two title:@"阅读" image:@"5656_08" selectedImage:@"5656_06"];
    
    ZR_threeViewController *three = [[ZR_threeViewController alloc] init];
    [self addChildVC:three title:@"书籍" image:@"阅读主页2_07" selectedImage:@"阅读主页jjjj_08"];
    ZR_fourViewController *four = [[ZR_fourViewController alloc] init];
    [self addChildVC:four title:@"" image:@"" selectedImage:@""];
    
    self.selectedIndex = 0;
    
}

-(void)addChildVC:(UIViewController *)childVC title:(NSString *)title image:(NSString *)image selectedImage:(NSString *)selectedImage{
    childVC.title = title;
    childVC.tabBarItem.title = title;
    childVC.tabBarItem.image = [UIImage imageNamed:image];
    childVC.tabBarItem.selectedImage = [UIImage imageNamed:selectedImage];
    
    
    ZRNavigationViewController *navigationController = [[ZRNavigationViewController alloc] initWithRootViewController:childVC];
    
    [self addChildViewController:navigationController];
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
